﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Data;
using DevExpress.XtraGrid.Views.Grid;

namespace QuanLyKho.KCS
{
    public partial class DanhSachMayKhoan : Form
    {
        public DanhSachMayKhoan()
        {
            InitializeComponent();
            LoadData();
            SetPropertiesGrid();
        }

        public void LoadData()
        {
            DataTable dtChoDuyet = DataAll.SelectAll("GiaCong inner join LenhSanXuat on GiaCong.SoChungTu = LenhSanXuat.SoChungTu inner join PhongMau_SanPham on GiaCong.IdSanPham = PhongMau_SanPham.IdSanPham",
                "*,LenhSanXuat.SoLuong as 'SoLuongMau',GiaCong.SoLuong as 'SoLuongThuc',GiaCong.TrangThai as 'TrangThai1'", "WHERE GiaCong.TrangThai = " + Convert.ToInt32(TrangThai.GiaCong_GuiDi) + " OR GiaCong.TrangThai = " + Convert.ToInt32(TrangThai.MayKhoan_GuiDi));
            gridChoDuyet.DataSource = dtChoDuyet;
        }

        public void SetPropertiesGrid()
        {
            gvChoDuyet.BestFitColumns();
            gvChoDuyet.FocusRectStyle = DrawFocusRectStyle.RowFullFocus;
            //gvChoDuyet.OptionsBehavior.Editable = false;
            //gvChoDuyet.OptionsSelection.MultiSelect = true;
            gvChoDuyet.OptionsView.ShowGroupPanel = false;
            gvChoDuyet.OptionsView.ShowFooter = true;
            gvChoDuyet.OptionsFind.AlwaysVisible = true;
            gvChoDuyet.Columns["ID"].Visible = false;

        }
    }
}
